namespace QMVnSoft.ReportForms
{
    using QMVnSoft;
    using QMVnSoft.Controls;
    using QMVnSoft.DAL;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class FormKQT02Viewer : FormReportViewer
    {
        private IContainer components;
        private LabelControl lblNgay_Ct0;
        private LabelControl lblNgay_Ct1;
        private LabelControl lblNgay_Ct2;
        private TextDate txtNgay_Ct0;
        private TextDate txtNgay_Ct1;
        private TextDate txtNgay_Ct2;

        public FormKQT02Viewer()
        {
            this.InitializeComponent();
            this.txtNgay_Ct1.Value = AppInstance.StartWorkingDate;
            this.txtNgay_Ct2.Value = AppInstance.EndWorkingDate;
            DateTime time = (DateTime) this.txtNgay_Ct1.Value;
            this.txtNgay_Ct0.Value = new DateTime(time.Year - 1, 1, 1);
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormKQT02Viewer));
            this.txtNgay_Ct2 = new QMVnSoft.Controls.TextDate();
            this.lblNgay_Ct2 = new QMVnSoft.Controls.LabelControl();
            this.txtNgay_Ct0 = new QMVnSoft.Controls.TextDate();
            this.lblNgay_Ct0 = new QMVnSoft.Controls.LabelControl();
            this.txtNgay_Ct1 = new QMVnSoft.Controls.TextDate();
            this.lblNgay_Ct1 = new QMVnSoft.Controls.LabelControl();
            this.rptContainer.Panel1.SuspendLayout();
            this.rptContainer.SuspendLayout();
            this.SuspendLayout();
            // 
            // rptContainer
            // 
            // 
            // rptContainer.Panel1
            // 
            this.rptContainer.Panel1.Controls.Add(this.txtNgay_Ct1);
            this.rptContainer.Panel1.Controls.Add(this.lblNgay_Ct1);
            this.rptContainer.Panel1.Controls.Add(this.txtNgay_Ct2);
            this.rptContainer.Panel1.Controls.Add(this.lblNgay_Ct2);
            this.rptContainer.Panel1.Controls.Add(this.txtNgay_Ct0);
            this.rptContainer.Panel1.Controls.Add(this.lblNgay_Ct0);
            this.rptContainer.Size = new System.Drawing.Size(794, 496);
            this.rptContainer.SplitterDistance = 67;
            // 
            // txtNgay_Ct2
            // 
            this.txtNgay_Ct2.DateTimeFormat  = QMVnSoft.Controls.TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ct2.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtNgay_Ct2.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite;
            this.txtNgay_Ct2.Location = new System.Drawing.Point(114, 24);
            this.txtNgay_Ct2.Mask = "00/00/0000";
            this.txtNgay_Ct2.Name = "txtNgay_Ct2";
            this.txtNgay_Ct2.OldValue = null;
            this.txtNgay_Ct2.Size = new System.Drawing.Size(100, 20);
            this.txtNgay_Ct2.TabIndex = 1;
            this.txtNgay_Ct2.Value = ((object)(resources.GetObject("txtNgay_Ct2.Value")));
            // 
            // lblNgay_Ct2
            // 
            this.lblNgay_Ct2.AutoSize = true;
            this.lblNgay_Ct2.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblNgay_Ct2.Location = new System.Drawing.Point(12, 27);
            this.lblNgay_Ct2.Name = "lblNgay_Ct2";
            this.lblNgay_Ct2.Size = new System.Drawing.Size(54, 14);
            this.lblNgay_Ct2.TabIndex = 97;
            this.lblNgay_Ct2.Text = "Đến ngày";
            // 
            // txtNgay_Ct0
            // 
            this.txtNgay_Ct0.DateTimeFormat  = QMVnSoft.Controls.TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ct0.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtNgay_Ct0.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite;
            this.txtNgay_Ct0.Location = new System.Drawing.Point(114, 45);
            this.txtNgay_Ct0.Mask = "00/00/0000";
            this.txtNgay_Ct0.Name = "txtNgay_Ct0";
            this.txtNgay_Ct0.OldValue = null;
            this.txtNgay_Ct0.Size = new System.Drawing.Size(100, 20);
            this.txtNgay_Ct0.TabIndex = 2;
            this.txtNgay_Ct0.Value = ((object)(resources.GetObject("txtNgay_Ct0.Value")));
            // 
            // lblNgay_Ct0
            // 
            this.lblNgay_Ct0.AutoSize = true;
            this.lblNgay_Ct0.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblNgay_Ct0.Location = new System.Drawing.Point(12, 48);
            this.lblNgay_Ct0.Name = "lblNgay_Ct0";
            this.lblNgay_Ct0.Size = new System.Drawing.Size(97, 14);
            this.lblNgay_Ct0.TabIndex = 98;
            this.lblNgay_Ct0.Text = "Ngày đầu kỳ trước";
            // 
            // txtNgay_Ct1
            // 
            this.txtNgay_Ct1.DateTimeFormat  = QMVnSoft.Controls.TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ct1.Font = new System.Drawing.Font("Arial", 8.25F);
            this.txtNgay_Ct1.InsertKeyMode = System.Windows.Forms.InsertKeyMode.Overwrite;
            this.txtNgay_Ct1.Location = new System.Drawing.Point(114, 3);
            this.txtNgay_Ct1.Mask = "00/00/0000";
            this.txtNgay_Ct1.Name = "txtNgay_Ct1";
            this.txtNgay_Ct1.OldValue = null;
            this.txtNgay_Ct1.Size = new System.Drawing.Size(100, 20);
            this.txtNgay_Ct1.TabIndex = 0;
            this.txtNgay_Ct1.Value = ((object)(resources.GetObject("txtNgay_Ct1.Value")));
            // 
            // lblNgay_Ct1
            // 
            this.lblNgay_Ct1.AutoSize = true;
            this.lblNgay_Ct1.Font = new System.Drawing.Font("Arial", 8.25F);
            this.lblNgay_Ct1.Location = new System.Drawing.Point(12, 6);
            this.lblNgay_Ct1.Name = "lblNgay_Ct1";
            this.lblNgay_Ct1.Size = new System.Drawing.Size(47, 14);
            this.lblNgay_Ct1.TabIndex = 100;
            this.lblNgay_Ct1.Text = "Từ ngày";
            // 
            // FormKQT02Viewer
            // 
            this.ClientSize = new System.Drawing.Size(794, 528);
            this.Name = "FormKQT02Viewer";
            this.UserLastKey = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.Menu)));
            this.rptContainer.Panel1.ResumeLayout(false);
            this.rptContainer.Panel1.PerformLayout();
            this.rptContainer.ResumeLayout(false);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        protected override void OnDeclare()
        {
            base.OnDeclare();
            new FormKQT02Lister().Show();
        }

        protected override void OnGenerateColumns()
        {
            object[][] objArray = new object[5][];
            object[] objArray2 = new object[4];
            objArray2[0] = "Dien_Giai";
            objArray2[1] = "Chỉ ti\x00eau";
            objArray2[2] = "C";
            objArray[0] = objArray2;
            object[] objArray3 = new object[4];
            objArray3[0] = "Stt0";
            objArray3[1] = "Mã số";
            objArray3[2] = "C";
            objArray[1] = objArray3;
            object[] objArray4 = new object[4];
            objArray4[0] = "TMinh";
            objArray4[1] = "Thuyết minh";
            objArray4[2] = "C";
            objArray[2] = objArray4;
            objArray[3] = new object[] { "Tien1", "Kỳ này", "N", AppInstance.TextNumericFormat.LocalAmount };
            objArray[4] = new object[] { "Tien0", "Kỳ trước", "N", AppInstance.TextNumericFormat.LocalAmount };
            base.LocalColNames = objArray;
            base.OnGenerateColumns();
        }

        protected override void OnMakeReport()
        {
            AppInstance.StartWorkingDate = (DateTime) this.txtNgay_Ct1.Value;
            AppInstance.EndWorkingDate = (DateTime) this.txtNgay_Ct2.Value;
            base.LocalTable = new ReportDataAccess().KQT02_Get(AppInstance.Subsidiaries, this.txtNgay_Ct1.Value, this.txtNgay_Ct2.Value, this.txtNgay_Ct0.Value, AppInstance.DefLanguage);
            base.OnMakeReport();
        }

        protected override void OnSendParameters()
        {
            base.StimulReport["Ngay"] = "Từ ngày " + string.Format("{0:dd/MM/yyyy}", this.txtNgay_Ct1.Value) + " đến ngày " + string.Format("{0:dd/MM/yyyy}", this.txtNgay_Ct2.Value);
        }
    }
}

